package com.ice.work.moment.facade.ticket.controller;


import com.honeybee.cloud.framework.base.exception.business.BaseBizException;
import com.honeybee.cloud.framework.common.annotation.ApiVersion;
import com.honeybee.cloud.framework.common.page.Page;
import com.honeybee.cloud.framework.common.response.ResponseEntity;
import com.ice.work.moment.facade.ticket.controller.fallback.UserHystrixFallbackFactory;
import com.ice.work.moment.facade.ticket.dto.PassengerDTO;
import com.ice.work.moment.facade.ticket.request.LoginRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Description 12306 user
 * @Author DELL
 * @Create 2019-04-29
 * @Since 1.0.0
 */
@SuppressWarnings("all")
@FeignClient(value = "moment-ticket-v1", fallbackFactory = UserHystrixFallbackFactory.class)
@RequestMapping("ticket-user/{version}")
@ApiVersion
public interface IUserController {

    /**
     * 用户登录
     *
     * @param request
     * @return
     */
    @RequestMapping(name = "用户登录", value = "login", method = RequestMethod.POST)
    ResponseEntity<String> login(@Validated @RequestBody LoginRequest request);

    /**
     * 用户登出
     * @param appKey
     * @return
     */
    @RequestMapping(name = "用户登出", value = "logout", method = RequestMethod.POST)
    ResponseEntity<Void> out(@RequestParam(value = "appKey",defaultValue = "") String appKey);

    /**
     * 查询常用联系人
     *
     * @param page
     * @param size
     * @param appKey
     * @return
     * @throws BaseBizException
     */
    @RequestMapping(name = "查询常用联系人", value = "query-passenger", method = RequestMethod.POST)
    ResponseEntity<Page<PassengerDTO>> queryPassengers(@RequestParam(value = "page",defaultValue = "1") Long page, @RequestParam(value = "size",defaultValue = "10") Long size, @RequestParam("appKey") String appKey) throws BaseBizException;

}
